/*
 * @Date: 2023-03-15 12:05:11
 * @LastEditTime: 2023-03-16 10:29:19
 * @FilePath: /hua-fei-chong-zhi/src/sdk/index.ts
 * 介绍:
 */
/**格式化失败返回数据 */
export function sdkFail<T>(message: string, data?: any): SdkRes<T> {
  console.error("sdk失败:" + message, data);
  return {
    message,
    status: false,
    info: data,
  };
}
/**格式化成功返回数据 */
export function sdkSucceed<T>(message: string, data?: any): SdkRes<T> {
  console.info("sdk成功:", message, data);
  data ||= true;
  return {
    message,
    status: true,
    data,
  };
}

export interface SdkRes<T> {
  message: string;
  /**获取成功失败状态 */
  status: boolean;
  data?: T;
  info?: T;
}
